package cn.bx.bid.repository;

import cn.bx.bid.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

//常用的父接口都有了,特殊自己加
public interface UserRepository extends JpaRepository<User, Long>, JpaSpecificationExecutor<User> {
    //sql:select * from user where name like ? and entertdate <?
    //加入name=null,忽略这个条件,自己处理
    // public List<User> findByNameContainingAndAndEnterdateLessThan(String name, Date enterdate);
    //按照姓名模糊查找
    public List<User> findByNameContaining(String name);

    public User findByUsername(String username);

    /*@Modifying
    @Query("update User set password=?2 where id=?1")
    int resetPass(long id, String newPass);
}*/
}
